package 蓝桥杯;

import java.util.Scanner;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/11/17
 */
public class fib {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        int n = s.nextInt();
        if (n == 0 || n == 1) {
            System.out.println(n);
            return;
        }
        int pre = 0;
        int next = 1;
        int sum = 0;
        for (int i = 2; i <= n; i++) {
            sum = pre + next;
            pre = next;
            next = sum % 10007;
        }
        System.out.println(next);
    }
}
